<template>
    <div><h2>添加</h2>
<table class="table">
    <tbody>
        <tr>
            <td>id</td>
            <td>
                {{ data.id }}
            </td>
        </tr>
        <tr>
            <td>房间名</td>
            <td>
                {{ data.name }}
            </td>
        </tr>
        <tr>
            <td>建筑面积</td>
            <td>
                {{ data.jianZhu }}
            </td>
        </tr>
        <tr>
            <td>套内面积</td>
            <td>
                {{ data.taoNie}}
            </td>
        </tr>
        <tr>
            <td>单价</td>
            <td>
                {{ data.price }}
            </td>
        </tr>
        
        <tr>
            <td>户型结构</td>
            <td>
                {{ data.type }}
            </td>
        </tr>
        <tr>
            <td>img</td>
            <td>
            </td>
        </tr>
        <tr>
            <td>看房时间</td>
            <td>
                {{ data.createDate}}
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <a href="/">返回列表</a>
            </td>
        </tr>
    </tbody>
</table>
    </div>
</template>

<script setup lang="ts">

import { ref,onMounted } from 'vue';
import axios from 'axios';
import { useRoute,useRouter } from 'vue-router';
const route=useRoute();

onMounted(()=>{
    XiangQing();
})

const data=ref({
  "id": 0,
  "name": "",
  "type": "",
  "jianZhu": 0,
  "taoNie": 0,
  "price": 0,
  "img": "",
  "createDate": ""
})

const XiangQing=()=>{
    var vid=route.query.id;
    axios.get("https://localhost:7154/api/Room/GetRoomId",{params:{id:vid}}).then(res=>{
        data.value=res.data;
        data.value.createDate=data.value.createDate.substring(0,10);
    })
}
</script>

<style scoped>

</style>